package com.ql.service.user;

import com.ql.dao.yk.DoctorMapper;
import com.ql.pojo.yk.Doctor;
import com.ql.pojo.yk.DoctorExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserService {
    @Autowired
    private DoctorMapper doctorMapper;

    /**
     * 登录功能
     * @param userName
     * @return
     */
    public Doctor login(String userName){

        DoctorExample doctorExample = new DoctorExample();
        DoctorExample.Criteria criteria = doctorExample.createCriteria();
        criteria.andDocloginEqualTo(userName);
        List<Doctor> doctors = doctorMapper.selectByExample(doctorExample);
        if(null!=doctors&&doctors.size()>0){
            return doctors.get(0);
        }
        return null;
    }
}
